package cn.edu.neusoft.yyd208.foodorder.activity;

import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import java.util.List;

import cn.edu.neusoft.yyd208.foodorder.R;
import cn.edu.neusoft.yyd208.foodorder.adapter.UserOrderAdapter;
import cn.edu.neusoft.yyd208.foodorder.bean.CommentFoodBean;
import cn.edu.neusoft.yyd208.foodorder.listener.ListListener;
import cn.edu.neusoft.yyd208.foodorder.model.UserOrderModel;

public class UserOrderActivity extends BaseActivity {
    UserOrderModel userOrderModel;
    List<CommentFoodBean> items;
    RecyclerView recyclerView;
ListListener<CommentFoodBean> userOrderListListener=new ListListener<CommentFoodBean>() {
    @Override
    public void onResponse(List<CommentFoodBean> list) {
        items=list;
        UserOrderAdapter myAdapter=new UserOrderAdapter(UserOrderActivity.this,items,R.layout.comment);
        recyclerView.setAdapter(myAdapter);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
    }

    @Override
    public void onFail(String msg) {

    }
};
    @Override
    void initView() {
        setLayout_file(R.layout.activity_user_order);
        recyclerView =(RecyclerView) findViewById(R.id.uorecyclerview);
        LinearLayoutManager linearLayoutManager=new LinearLayoutManager(this);
        linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(linearLayoutManager);
    }

    @Override
    void initEvent() {

    }

    @Override
    void initData() {
        String userid=getUser_userid();
        userOrderModel=new UserOrderModel();
        userOrderModel.getFoodMessage(userid,userOrderListListener);

    }


}
